package mop.exception;


/**
 * Exception class for incorrect users
 * when a user is requested that doesn't
 * exist in the database call this baby
 * 
 * @invar none this is a exception
 * 
 * @author	 MOP Team 7
 */
public class IllegalProjectException extends Throwable 
{

	/**
	 * Initializes an IllegalNameException with the passed project
	 * 
	 * @param user
	 *  the user that apparantly doesn't exist
	 *  
	 * @effect set the user
	 */
	public IllegalProjectException(String project)
	{
		this.setName(project);	
	}
	
	/**
	 * return a error message that can be used by the gui
	 * 
	 * @return an error message describing the incorrect user
	 */
	public String toString()
	{
		
		StringBuffer sb = new StringBuffer();
		sb.append("The following project is not a valid one, it probably doesn't exist yet ! ");
		
		if(this.project == null)
			sb.append("NULL");
		else if(this.project.trim().equals(""))
		{
			sb.append("/emptyString");
		}
		else
		{
			sb.append(this.project);
		}
		
		return sb.toString();
		
	}
	
	 /**
	  * set the project
	  * 
	  * @param project
	  *  the project that's causing a racket
	  *  
	  * @post the user is set to the passed one
	  * 
	  */
	 private void setName(String project) 
	 {

		 this.project = project;
	 }
	
	/**
	 * weird java demand
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * the project thats causing the problem
	 */
	private String project;
	
}
